3.20 \(\int \frac {\sin (x)}{a+b \cot (x)} \, dx\)

Optimal. Leaf size=66 \[ -\frac {b \sin (x)}{a^2+b^2}-\frac {a \cos (x)}{a^2+b^2}+\frac {b^2 \tanh ^{-1}\left (\frac {\sin (x) (b-a \cot (x))}{\sqrt {a^2+b^2}}\right )}{\left (a^2+b^2\right )^{3/2}} \]

[Out]

b^2*arctanh((b-a*cot(x))*sin(x)/(a^2+b^2)^(1/2))/(a^2+b^2)^(3/2)-a*cos(x)/(a^2+b^2)-b*sin(x)/(a^2+b^2)

________________________________________________________________________________________

Rubi [A]  time = 0.09, antiderivative size = 66, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.454, Rules used = {3511, 3486, 2638, 3509, 206} \[ -\frac {b \sin (x)}{a^2+b^2}-\frac {a \cos (x)}{a^2+b^2}+\frac {b^2 \tanh ^{-1}\left (\frac {\sin (x) (b-a \cot (x))}{\sqrt {a^2+b^2}}\right )}{\left (a^2+b^2\right )^{3/2}} \]

Antiderivative was successfully verified.

[In]

Int[Sin[x]/(a + b*Cot[x]),x]

[Out]

(b^2*ArcTanh[((b - a*Cot[x])*Sin[x])/Sqrt[a^2 + b^2]])/(a^2 + b^2)^(3/2) - (a*Cos[x])/(a^2 + b^2) - (b*Sin[x])
/(a^2 + b^2)

Rule 206

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTanh[(Rt[-b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[-b, 2]), x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 2638

Int[sin[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Cos[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3486

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b*(d*Sec[
e + f*x])^m)/(f*m), x] + Dist[a, Int[(d*Sec[e + f*x])^m, x], x] /; FreeQ[{a, b, d, e, f, m}, x] && (IntegerQ[2
*m] || NeQ[a^2 + b^2, 0])

Rule 3509

Int[sec[(e_.) + (f_.)*(x_)]/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> -Dist[f^(-1), Subst[Int[1/(a^
2 + b^2 - x^2), x], x, (b - a*Tan[e + f*x])/Sec[e + f*x]], x] /; FreeQ[{a, b, e, f}, x] && NeQ[a^2 + b^2, 0]

Rule 3511

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_)/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[1/(a^2 + b^
2), Int[(d*Sec[e + f*x])^m*(a - b*Tan[e + f*x]), x], x] + Dist[b^2/(d^2*(a^2 + b^2)), Int[(d*Sec[e + f*x])^(m
+ 2)/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, d, e, f}, x] && NeQ[a^2 + b^2, 0] && ILtQ[m, 0]

Rubi steps

\begin {align*} \int \frac {\sin (x)}{a+b \cot (x)} \, dx &=\frac {\int (a-b \cot (x)) \sin (x) \, dx}{a^2+b^2}+\frac {b^2 \int \frac {\csc (x)}{a+b \cot (x)} \, dx}{a^2+b^2}\\ &=-\frac {b \sin (x)}{a^2+b^2}+\frac {a \int \sin (x) \, dx}{a^2+b^2}-\frac {b^2 \operatorname {Subst}\left (\int \frac {1}{a^2+b^2-x^2} \, dx,x,(-b+a \cot (x)) \sin (x)\right )}{a^2+b^2}\\ &=\frac {b^2 \tanh ^{-1}\left (\frac {(b-a \cot (x)) \sin (x)}{\sqrt {a^2+b^2}}\right )}{\left (a^2+b^2\right )^{3/2}}-\frac {a \cos (x)}{a^2+b^2}-\frac {b \sin (x)}{a^2+b^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.24, size = 62, normalized size = 0.94 \[ \frac {2 b^2 \tanh ^{-1}\left (\frac {b \tan \left (\frac {x}{2}\right )-a}{\sqrt {a^2+b^2}}\right )}{\left (a^2+b^2\right )^{3/2}}-\frac {a \cos (x)+b \sin (x)}{a^2+b^2} \]

Antiderivative was successfully verified.

[In]

Integrate[Sin[x]/(a + b*Cot[x]),x]

[Out]

(2*b^2*ArcTanh[(-a + b*Tan[x/2])/Sqrt[a^2 + b^2]])/(a^2 + b^2)^(3/2) - (a*Cos[x] + b*Sin[x])/(a^2 + b^2)

________________________________________________________________________________________

fricas [B]  time = 0.65, size = 146, normalized size = 2.21 \[ \frac {\sqrt {a^{2} + b^{2}} b^{2} \log \left (-\frac {2 \, a b \cos \relax (x) \sin \relax (x) - {\left (a^{2} - b^{2}\right )} \cos \relax (x)^{2} - a^{2} - 2 \, b^{2} + 2 \, \sqrt {a^{2} + b^{2}} {\left (a \cos \relax (x) - b \sin \relax (x)\right )}}{2 \, a b \cos \relax (x) \sin \relax (x) - {\left (a^{2} - b^{2}\right )} \cos \relax (x)^{2} + a^{2}}\right ) - 2 \, {\left (a^{3} + a b^{2}\right )} \cos \relax (x) - 2 \, {\left (a^{2} b + b^{3}\right )} \sin \relax (x)}{2 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)/(a+b*cot(x)),x, algorithm="fricas")

[Out]

1/2*(sqrt(a^2 + b^2)*b^2*log(-(2*a*b*cos(x)*sin(x) - (a^2 - b^2)*cos(x)^2 - a^2 - 2*b^2 + 2*sqrt(a^2 + b^2)*(a
*cos(x) - b*sin(x)))/(2*a*b*cos(x)*sin(x) - (a^2 - b^2)*cos(x)^2 + a^2)) - 2*(a^3 + a*b^2)*cos(x) - 2*(a^2*b +
 b^3)*sin(x))/(a^4 + 2*a^2*b^2 + b^4)

________________________________________________________________________________________

giac [A]  time = 0.73, size = 94, normalized size = 1.42 \[ -\frac {b^{2} \log \left (\frac {{\left | 2 \, b \tan \left (\frac {1}{2} \, x\right ) - 2 \, a - 2 \, \sqrt {a^{2} + b^{2}} \right |}}{{\left | 2 \, b \tan \left (\frac {1}{2} \, x\right ) - 2 \, a + 2 \, \sqrt {a^{2} + b^{2}} \right |}}\right )}{{\left (a^{2} + b^{2}\right )}^{\frac {3}{2}}} - \frac {2 \, {\left (b \tan \left (\frac {1}{2} \, x\right ) + a\right )}}{{\left (a^{2} + b^{2}\right )} {\left (\tan \left (\frac {1}{2} \, x\right )^{2} + 1\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)/(a+b*cot(x)),x, algorithm="giac")

[Out]

-b^2*log(abs(2*b*tan(1/2*x) - 2*a - 2*sqrt(a^2 + b^2))/abs(2*b*tan(1/2*x) - 2*a + 2*sqrt(a^2 + b^2)))/(a^2 + b
^2)^(3/2) - 2*(b*tan(1/2*x) + a)/((a^2 + b^2)*(tan(1/2*x)^2 + 1))

________________________________________________________________________________________

maple [A]  time = 0.25, size = 84, normalized size = 1.27 \[ \frac {8 b^{2} \arctanh \left (\frac {2 \tan \left (\frac {x}{2}\right ) b -2 a}{2 \sqrt {a^{2}+b^{2}}}\right )}{\left (4 a^{2}+4 b^{2}\right ) \sqrt {a^{2}+b^{2}}}+\frac {-2 \tan \left (\frac {x}{2}\right ) b -2 a}{\left (a^{2}+b^{2}\right ) \left (\tan ^{2}\left (\frac {x}{2}\right )+1\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)/(a+b*cot(x)),x)

[Out]

8*b^2/(4*a^2+4*b^2)/(a^2+b^2)^(1/2)*arctanh(1/2*(2*tan(1/2*x)*b-2*a)/(a^2+b^2)^(1/2))+2/(a^2+b^2)*(-tan(1/2*x)
*b-a)/(tan(1/2*x)^2+1)

________________________________________________________________________________________

maxima [A]  time = 0.69, size = 106, normalized size = 1.61 \[ -\frac {b^{2} \log \left (\frac {a - \frac {b \sin \relax (x)}{\cos \relax (x) + 1} + \sqrt {a^{2} + b^{2}}}{a - \frac {b \sin \relax (x)}{\cos \relax (x) + 1} - \sqrt {a^{2} + b^{2}}}\right )}{{\left (a^{2} + b^{2}\right )}^{\frac {3}{2}}} - \frac {2 \, {\left (a + \frac {b \sin \relax (x)}{\cos \relax (x) + 1}\right )}}{a^{2} + b^{2} + \frac {{\left (a^{2} + b^{2}\right )} \sin \relax (x)^{2}}{{\left (\cos \relax (x) + 1\right )}^{2}}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)/(a+b*cot(x)),x, algorithm="maxima")

[Out]

-b^2*log((a - b*sin(x)/(cos(x) + 1) + sqrt(a^2 + b^2))/(a - b*sin(x)/(cos(x) + 1) - sqrt(a^2 + b^2)))/(a^2 + b
^2)^(3/2) - 2*(a + b*sin(x)/(cos(x) + 1))/(a^2 + b^2 + (a^2 + b^2)*sin(x)^2/(cos(x) + 1)^2)

________________________________________________________________________________________

mupad [B]  time = 0.39, size = 94, normalized size = 1.42 \[ -\frac {\frac {2\,a}{a^2+b^2}+\frac {2\,b\,\mathrm {tan}\left (\frac {x}{2}\right )}{a^2+b^2}}{{\mathrm {tan}\left (\frac {x}{2}\right )}^2+1}-\frac {2\,b^2\,\mathrm {atanh}\left (\frac {2\,a\,b^2+2\,a^3-2\,b\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (a^2+b^2\right )}{2\,{\left (a^2+b^2\right )}^{3/2}}\right )}{{\left (a^2+b^2\right )}^{3/2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)/(a + b*cot(x)),x)

[Out]

- ((2*a)/(a^2 + b^2) + (2*b*tan(x/2))/(a^2 + b^2))/(tan(x/2)^2 + 1) - (2*b^2*atanh((2*a*b^2 + 2*a^3 - 2*b*tan(
x/2)*(a^2 + b^2))/(2*(a^2 + b^2)^(3/2))))/(a^2 + b^2)^(3/2)

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\sin {\relax (x )}}{a + b \cot {\relax (x )}}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)/(a+b*cot(x)),x)

[Out]

Integral(sin(x)/(a + b*cot(x)), x)

________________________________________________________________________________________